package com.czxy.changgou4.controller;

import com.czxy.changgou4.pojo.Specification;
import com.czxy.changgou4.service.SpecService;
import com.czxy.changgou4.vo.BaseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 桐叔
 * @email liangtong@itcast.cn
 */
@RestController
@RequestMapping("/specifications")
public class SpecController {
    @Resource
    private SpecService specService;

    @GetMapping("/category/{categoryId}")
    public BaseResult selectAllByCid(@PathVariable("categoryId") Integer categoryId) {

        // 查询
        List<Specification> specList = specService.selectAllByCid(categoryId);

        // 返回
        return BaseResult.ok("查询成功", specList);

    }


}
